<?php 
	$auth = Zend_Auth::getInstance();
    $identity = $auth->getIdentity();
    $permission = explode("|",$identity->permission);
?>
<?php if (in_array(1, $permission) || $identity->admin ==  1) : ?>
<a href = "/admin/product/add?os=<?php echo $this->arrParam['os']?>" style="background: #359AFF;
			padding: 15px 25px;
			display: inline-block;
			margin-top: 10px;
			color: #fff;
			text-transform: uppercase;
			font-size: 16px;
			text-decoration: none;
">
	Thêm sản phẩm mới
</a>
<?php endif;?>
<?php if (in_array(3, $permission) || $identity->admin ==  1) : ?>
<a href = "/admin/banner" style="background: #359AFF;
			padding: 15px 25px;
			display: inline-block;
			margin-top: 10px;
			color: #fff;
			text-transform: uppercase;
			font-size: 16px;
			text-decoration: none;
">
	Quản lý banner
</a>
<?php endif;?>
<?php if (in_array(4, $permission) || $identity->admin ==  1) : ?>
<a href = "/admin/suggestion" style="background: #359AFF;
			padding: 15px 25px;
			display: inline-block;
			margin-top: 10px;
			color: #fff;
			text-transform: uppercase;
			font-size: 16px;
			text-decoration: none;
">
	Quản lý gợi ý cho người dùng
</a>
<?php endif;?>
<?php if (in_array(5, $permission) || $identity->admin ==  1) : ?>
<a href = "/admin/category" style="background: #359AFF;
			padding: 15px 25px;
			display: inline-block;
			margin-top: 10px;
			color: #fff;
			text-transform: uppercase;
			font-size: 16px;
			text-decoration: none;
">
	Quản lý mục con
</a>
<?php endif;?>
<br />
<br />
<table class="table table-bordered table-striped">
	<tr>
		<th>STT</th>
		<th>Tên sản phẩm</th>
		<th>Nhà phát triển</th>
		<th>Chuyên mục</th>
		<th>Lượt tải</th>
		<th>Đánh giá</th>
		<th>Cập nhật gần đây</th>
		<th>Trạng thái</th>
		<th>Xóa</th>
	</tr>
	<?php foreach ($this->paginator as $key => $value):?>
		<?php $update = new Zend_Date($value['update'],'yyyy-MM-dd HH:mm:ss')?>
		<tr>
			<td><?php echo $key + 1 + $this->paginator->getItemCountPerPage() * ($this->paginator->getCurrentPageNumber() - 1)?></td>
			<td><a href="/admin/product/edit/id/<?php echo $value["id"]?>"><img src="<?php echo $value['icon']?>" width="30px" height="30px">&nbsp;&nbsp;<?php echo $value['name']?></a></td>
			<td><?php echo $value['developer']?></td>
			<td><?php echo $value['category']?></td>
			<td><?php echo $value['download']?></td>
			<td></td>
			<td><?php echo $update->toString("MMM dd, yyyy")?></td>
			<td><?php echo ($value['status'])?"Đang chạy":"Tạm dừng"?></td>
			<td><a class="btn btn-default" href="/admin/product/delete/id/<?php echo $value['id']?>" onclick="return confirm('Bạn có chắc chắn muốn xóa?');"><i class="glyphicon glyphicon-edit"></i> Xóa</a></td>
		</tr>
	<?php endforeach;?>
</table>

	<?php 
	echo $this->paginator;
